//
//  NewCityDynamicModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/9/12.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class NewCityDynamicModel: NSObject {

    
    var message_cover = ""
    var message_time = ""
    var message_title = ""
    var message_url = ""
    var message_id = ""
    var message_view = ""
    var message_desc = ""
    var message_type = ""
    var subMessage_list = [SubMessageModel]()
    

    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "subMessage_list" {
            
            for item in value as! [[String : AnyObject]] {
                
                subMessage_list.append(SubMessageModel(dic: item))
                
            }
            
        } else {
            
            
            super.setValue(value, forKey: key)
        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }
    
    
    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["message_cover","message_time","message_title","message_url","message_id","message_view","message_desc","subMessage_list","message_type"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }

    

}











/*
 {
 "code": "200",
 "hasmore": "1",
 "page_total": "3",
 "msg": "",
 "datas": {
 "message_list": [
 {
 "message_cover": "http://mall.xjscvip.com/data/upload/shop/article/05585240054990974.jpg",
 "messageTime": "2017-11-01",
 "message_title": "国家突然宣布，这个百年不变的行业将发生“大地震”！",
 "message_url": "http://mall.xjscvip.com/wap/tmpl/article_show.html?article_id=37",
 "message_id": "37",
 "message_desc": "",
 "message_view": "5"
 "subMessage_list": [
 {
 "subMessage_cover": "http://mall.xjscvip.com/data/upload/shop/article/05585240054990974.jpg",
 "subMessage_url": "http://mall.xjscvip.com/wap/tmpl/article_show.html?article_id=37"
 "subMessage_title": "国家突然宣布，这个百年不变的行业将发生“大地震”！",
 }               ]
 }
 ]
 }
 }
 
 */
